module.exports = function (fn, config = {}) {
    return new Promise((resolve, reject) => {
        fn(Object.assign({
            success: res => {
                resolve(res)
            },
            fail: err => {
                reject(err)
            }
        }, config))
    })
}